#include "Control/GUITitlebar.h"
#include "GUISystem.h"
#include "GUILogger.h"

namespace YGUI
{
    const String Titlebar::WidgetTypeName("Titlebar");

    Titlebar::Titlebar(const String& type, const String& name) : 
        Window(type, name)
    {
        m_dragEnabled = true;
    }

    void Titlebar::onMouseMove(MouseEventArgs& e)
    {
        Window::onMouseMove(e);
    }

    void Titlebar::onMouseButtonDown(MouseEventArgs& e)
    {
        Window::onMouseButtonDown(e);
    }

    void Titlebar::onMouseButtonUp(MouseEventArgs& e)
    {
        Window::onMouseButtonUp(e);
    }

    void Titlebar::mouseMoveWindow_impl(const Vector2<float>& delta)
    {
        if(m_parent)
        {
            m_parent->offsetPixelPosition(delta);
        }
    }

    IMPLEMENT_Property(Titlebar, DraggingEnabled, 0, "Property to get/set the state of the dragging enabled setting for the Titlebar."
        " Value is either \"True\" or \"False\".")
};
